﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache" content="no-cache" />
    <title>急性胸痛患者时间管理表</title>
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script src="~/Scripts/common.js?v=@DateTime.Now.ToString("yyyyMMdd")"></script>
    <script src="~/Scripts/CreateControl.js?v=@DateTime.Now.ToString("yyyyMMdd")" type="text/javascript"></script>
</head>
<body style="height:1500px;">
    <script type="text/javascript">
        CreatePrintViewerEx("100%", "80%", '@Url.Content("~/Grf/急性胸痛患者时间管理表.grf")' + '?id=' + getRnd(), "", true, "<param name=BorderStyle value=1>");
        $(document).ready(function () {
            PrintStart();
        });
        function PrintStart() {
            var pid = "@ViewBag.pid";
            $.ajax({
                url: "/ChestPainCenter/MedicalRecords/GetCaseHistory?Pid=" + pid,
                cache: false,
                success: function (data) {
                    var d = $.parseJSON(data);
                    if (d.Result == 1) {
                        var jsonData = $.parseJSON(d.Body);
                        ReportViewer.Stop();
                        var Report = ReportViewer.Report;
                        var Recordset = ReportViewer.Report.DetailGrid.Recordset;
                        var PATIENT_ID = ReportViewer.Report.FieldByName("PATIENT_ID");
                        var PATIENT_NAME = ReportViewer.Report.FieldByName("PATIENT_NAME");
                        var PATIENT_SEX = ReportViewer.Report.FieldByName("PATIENT_SEX");
                        var PATIENT_AGE = ReportViewer.Report.FieldByName("PATIENT_AGE");
                        var PATIENT_PHONE = ReportViewer.Report.FieldByName("PATIENT_PHONE");
                        var PATIENT_ID_NUM = ReportViewer.Report.FieldByName("PATIENT_ID_NUM");
                        var PATIENT_ARRIVE_CLASS = ReportViewer.Report.FieldByName("PATIENT_ARRIVE_CLASS");
                        var H_MEDICAL_TIME = ReportViewer.Report.FieldByName("H_MEDICAL_TIME");
                        var EMS_DISEASE_TIME = ReportViewer.Report.FieldByName("EMS_DISEASE_TIME");
                        var EMS_DISEASE_ADDR = ReportViewer.Report.FieldByName("EMS_DISEASE_ADDR");
                        var TransferHospitalName = ReportViewer.Report.FieldByName("TransferHospitalName");
                        var EMS_MESSAGE_TIME = ReportViewer.Report.FieldByName("EMS_MESSAGE_TIME");
                        var EMS_ARRIVE_TIME = ReportViewer.Report.FieldByName("EMS_ARRIVE_TIME");
                        var EMS_BACKTO_TIME = ReportViewer.Report.FieldByName("EMS_BACKTO_TIME");
                        var PRE_ECG_TIME = ReportViewer.Report.FieldByName("PRE_ECG_TIME");
                        var Delivery_Time = ReportViewer.Report.FieldByName("Delivery_Time");
                        var EMS_ARRIVEDOOR_TIME = ReportViewer.Report.FieldByName("EMS_ARRIVEDOOR_TIME");
                        var THROUGH_TO_TIME = ReportViewer.Report.FieldByName("THROUGH_TO_TIME");
                        var Catheter_Ecg_Time = ReportViewer.Report.FieldByName("Catheter_Ecg_Time");
                        var DrawBloodTime = ReportViewer.Report.FieldByName("DrawBloodTime");
                        var PATIENT_CONSCIOUSNESS = ReportViewer.Report.FieldByName("PATIENT_ CONSCIOUSNESS");
                        var PATIENT_BLOOD_H = ReportViewer.Report.FieldByName("PATIENT_BLOOD_H");
                        var PATIENT_PULSE = ReportViewer.Report.FieldByName("PATIENT_PULSE");
                        var PATIENT_BREATHE = ReportViewer.Report.FieldByName("PATIENT_BREATHE");
                        var FRIST_H_ECG_TIME = ReportViewer.Report.FieldByName("FRIST_H_ECG_TIME");
                        var ReportTime = ReportViewer.Report.FieldByName("ReportTime");
                        var PRE_DIAGNOSIS_TIME = ReportViewer.Report.FieldByName("PRE_DIAGNOSIS_TIME");
                        var PRE_DIAGNOSIS = ReportViewer.Report.FieldByName("PRE_DIAGNOSIS");                        
                        var ConsultatTime = ReportViewer.Report.FieldByName("ConsultatTime");
                        var DiseaseDep = ReportViewer.Report.FieldByName("DiseaseDep");
                        var FRIST_DOC_NAME = ReportViewer.Report.FieldByName("FRIST_ DOC_NAME");
                        var Medical_Name = ReportViewer.Report.FieldByName("Medical_Name");
                        var ThrombolysisTime = ReportViewer.Report.FieldByName("ThrombolysisTime");
                        var Ecg_Time = ReportViewer.Report.FieldByName("Ecg_Time");
                        var ECG_CONFIRM_TIME = ReportViewer.Report.FieldByName("ECG_CONFIRM_TIME");
                        var FirstDiagnosisTime = ReportViewer.Report.FieldByName("FirstDiagnosisTime");
                        var MeetRoomName = ReportViewer.Report.FieldByName("MeetRoomName");
                        var ConsultationTime = ReportViewer.Report.FieldByName("ConsultationTime");
                        var DeliveryTime = ReportViewer.Report.FieldByName("DeliveryTime");
                        var AspirinYn = ReportViewer.Report.FieldByName("AspirinYn");
                        var TicagrelorYn = ReportViewer.Report.FieldByName("TicagrelorYn");
                        var ClopidogrelYn = ReportViewer.Report.FieldByName("ClopidogrelYn");
                        var DeterminCatheterTime = ReportViewer.Report.FieldByName("DeterminCatheterTime");
                        var StartinforConsentTime = ReportViewer.Report.FieldByName("StartinforConsentTime");
                        var SigninforConsentTime = ReportViewer.Report.FieldByName("SigninforConsentTime");
                        var Enzyme = ReportViewer.Report.FieldByName("Enzyme");
                        var Urokinase = ReportViewer.Report.FieldByName("Urokinase");
                        var LeaveRoomTime = ReportViewer.Report.FieldByName("LeaveRoomTime");
                        var GuessD2BMins = ReportViewer.Report.FieldByName("GuessD2BMins");
                        var Doubt_Radiology_NoticeTime = ReportViewer.Report.FieldByName("通知放射科时间");
                        var Doubt_Radiology_ArriveTime = ReportViewer.Report.FieldByName("到达放射科时间");
                        var Doubt_Radiography_Time = ReportViewer.Report.FieldByName("摄片开始时间");
                        var Doubt_Radiography_DIAGNOSISTime = ReportViewer.Report.FieldByName("摄片诊断时间");
                        var Doubt_Radiography_DIAGNOSIS = ReportViewer.Report.FieldByName("诊断");
                        var dgsjhsj = ReportViewer.Report.FieldByName("导管室激活时间");
                        var hzdddgssj = ReportViewer.Report.FieldByName("患者到达导管室时间");
                        var sskssj = ReportViewer.Report.FieldByName("手术开始时间");
                        var ssjssj = ReportViewer.Report.FieldByName("手术结束时间");
                        var cckssj = ReportViewer.Report.FieldByName("开始穿刺时间");
                        var cccgsj = ReportViewer.Report.FieldByName("穿刺成功时间");
                        var zykssj = ReportViewer.Report.FieldByName("造影开始时间");
                        var zyjssj = ReportViewer.Report.FieldByName("造影结束时间");
                        var scqnkzsj = ReportViewer.Report.FieldByName("球囊扩张时间");
                        var LeaveHospitalTime = ReportViewer.Report.FieldByName("LeaveHospitalTime");
                        var Aspirin = ReportViewer.Report.FieldByName("Aspirin");
                        var Ticagrelor = ReportViewer.Report.FieldByName("Ticagrelor");
                        var Clopidogrel = ReportViewer.Report.FieldByName("Clopidogrel");
                        var RoomMeetTime = ReportViewer.Report.FieldByName("RoomMeetTime");
                        var Contact_Time = ReportViewer.Report.FieldByName("Contact_Time");
                        var Rosuvastatin = ReportViewer.Report.FieldByName("Rosuvastatin");
                        var Atorvastatin = ReportViewer.Report.FieldByName("Atorvastatin");
                        var RosuvastatinYn = ReportViewer.Report.FieldByName("RosuvastatinYn");
                        var AtorvastatinYn = ReportViewer.Report.FieldByName("AtorvastatinYn");
                        Report.PrepareLoadData();
                        Recordset.Append();
                        Contact_Time.AsString = obj2Timemm(jsonData.Contact_Time);
                        RoomMeetTime.AsString = obj2Timemm(jsonData.RoomMeetTime); 
                        PATIENT_ID.AsString = IsEmpty(jsonData.PatientId) ? "" : jsonData.PatientId;
                        PATIENT_NAME.AsString = IsEmpty(jsonData.PatientName) ? "" : jsonData.PatientName;
                        PATIENT_SEX.AsString = IsEmpty(jsonData.PatientSex) ? "" : jsonData.PatientSex;
                        PATIENT_AGE.AsString = IsEmpty(jsonData.PatientAge) ? "" : jsonData.PatientAge;
                        PATIENT_PHONE.AsString = IsEmpty(jsonData.PatientPhone) ? "" : jsonData.PatientPhone;
                        PATIENT_ID_NUM.AsString = IsEmpty(jsonData.PatientIdNum) ? "" : jsonData.PatientIdNum;
                        PATIENT_ARRIVE_CLASS.AsString = GetArriveClassName(jsonData.PatientArriveClass);
                        H_MEDICAL_TIME.AsString = obj2Timemm(jsonData.HMedicalTime);
                        EMS_DISEASE_TIME.AsString = obj2Timemm(jsonData.EmsDiseaseTime);
                        EMS_DISEASE_ADDR.AsString = IsEmpty(jsonData.EMS_DISEASE_ADDR) ? "" : jsonData.EMS_DISEASE_ADDR;
                        TransferHospitalName.AsString = IsEmpty(jsonData.TransferHospitalName) ? "" : jsonData.TransferHospitalName;
                        EMS_MESSAGE_TIME.AsString = obj2Timemm(jsonData.HelpTime);
                        EMS_ARRIVE_TIME.AsString = obj2Timemm(jsonData.EmsArriveDoorTime);
                        EMS_BACKTO_TIME.AsString = obj2Timemm(jsonData.AMBULANCE_Contact_Time);
                        PRE_ECG_TIME.AsString = obj2Timemm(jsonData.AMEcg_Time);
                        Delivery_Time.AsString = obj2Timemm(jsonData.Delivery_Time);
                        EMS_ARRIVEDOOR_TIME.AsString = obj2Timemm(jsonData.ArriveDoorTime);
                        THROUGH_TO_TIME.AsString = obj2Timemm(jsonData.ThroughToTime);
                        Catheter_Ecg_Time.AsString = obj2Timemm(jsonData.Catheter_Ecg_Time);
                        DrawBloodTime.AsString = obj2Timemm(jsonData.DrawBloodTime);
                        PATIENT_CONSCIOUSNESS.AsString = GetConsciousness(jsonData.PatientConsciousness);
                        PATIENT_BLOOD_H.AsString = (IsEmpty(jsonData.PatientBloodH) || IsEmpty(jsonData.PatientBloodL)) ? "" : (jsonData.PatientBloodH + "/" + jsonData.PatientBloodL + " mmHg")
                        PATIENT_PULSE.AsString = IsEmpty(jsonData.PatientPulse) ? "" : (jsonData.PatientPulse + "次/分");
                        PATIENT_BREATHE.AsString = IsEmpty(jsonData.PatientBreathe) ? "" : (jsonData.PatientBreathe + "次/分");
                        ECG_CONFIRM_TIME.AsString = obj2Timemm(jsonData.EcgConfirmTime);
                        FRIST_H_ECG_TIME.AsString = obj2Timemm(jsonData.Ecg_Time);
                        ReportTime.AsString = obj2Timemm(jsonData.ReportTime);
                        PRE_DIAGNOSIS_TIME.AsString = obj2Timemm(jsonData.PRE_DIAGNOSIS_TIME);
                        PRE_DIAGNOSIS.AsString = IsEmpty(jsonData.PreDiagnosis) ? "" : jsonData.PreDiagnosis;
                        ConsultationTime.AsString = obj2Timemm(jsonData.ConsultationTime);
                        ConsultatTime.AsString = obj2Timemm(jsonData.ConsultatTime);
                        DiseaseDep.AsString = IsEmpty(jsonData.DiseaseDep) ? "" : jsonData.DiseaseDep;
                        //首诊医师
                        FRIST_DOC_NAME.AsString = IsEmpty(jsonData.AMMedical_Name) ? "" : jsonData.AMMedical_Name;
                        //会诊医师
                        Medical_Name.AsString = IsEmpty(jsonData.Medical_Name) ? "" : jsonData.Medical_Name;
                        ThrombolysisTime.AsString = obj2Timemm(jsonData.ThrombolysisTime);
                        Ecg_Time.AsString = obj2Timemm(jsonData.Ecg_Time);
                        FirstDiagnosisTime.AsString = obj2Timemm(jsonData.FirstDiagnosisTime);
                        MeetRoomName.AsString = IsEmpty(jsonData.MeetRoomName) ? "" : jsonData.MeetRoomName;                        
                        DeliveryTime.AsString = obj2Timemm(jsonData.DeliveryTime);
                        AspirinYn.AsString = IsEmpty(jsonData.AspirinYn) ? "" : jsonData.AspirinYn;
                        TicagrelorYn.AsString = IsEmpty(jsonData.TicagrelorYn) ? "" : jsonData.TicagrelorYn;
                        ClopidogrelYn.AsString = IsEmpty(jsonData.ClopidogrelYn) ? "" : jsonData.ClopidogrelYn;
                        DeterminCatheterTime.AsString = obj2Timemm(jsonData.DeterminCatheterTime);
                        StartinforConsentTime.AsString = obj2Timemm(jsonData.StartinforConsentTime);
                        SigninforConsentTime.AsString = obj2Timemm(jsonData.SigninforConsentTime);
                        Enzyme.AsString = IsEmpty(jsonData.Enzyme) ? "" : jsonData.Enzyme;
                        Urokinase.AsString = IsEmpty(jsonData.Urokinase) ? "" : jsonData.Urokinase;
                        LeaveRoomTime.AsString = obj2Timemm(jsonData.LeaveRoomTime);
                        GuessD2BMins.AsString = "";                         
                        if (!IsEmpty(jsonData.GuessD2BMins)) {
                            if (parseInt(jsonData.GuessD2BMins) > 90) {
                                GuessD2BMins.AsString = "评估" + jsonData.GuessD2BMins + "分钟 大于90分钟"
                            }
                            if (parseInt(jsonData.GuessD2BMins) < 90) {
                                GuessD2BMins.AsString = "评估" + jsonData.GuessD2BMins + "分钟 小于90分钟"
                            }
                            if (parseInt(jsonData.GuessD2BMins) == 90) {
                                GuessD2BMins.AsString = "评估" + jsonData.GuessD2BMins + "分钟"
                            }
                        }
                        Doubt_Radiology_NoticeTime.AsString = obj2Timemm(jsonData.Doubt_Radiology_NoticeTime);
                        Doubt_Radiology_ArriveTime.AsString = obj2Timemm(jsonData.Doubt_Radiology_ArriveTime);
                        Doubt_Radiography_Time.AsString = obj2Timemm(jsonData.Doubt_Radiography_Time);
                        Doubt_Radiography_DIAGNOSISTime.AsString = obj2Timemm(jsonData.Doubt_Radiography_DIAGNOSISTime);
                        Doubt_Radiography_DIAGNOSIS.AsString = IsEmpty(jsonData.Doubt_Radiography_DIAGNOSIS) ? "" : jsonData.Doubt_Radiography_DIAGNOSIS;
                        dgsjhsj.AsString = obj2Timemm(jsonData.导管室激活时间);
                        hzdddgssj.AsString = obj2Timemm(jsonData.患者到达导管室时间);
                        sskssj.AsString = obj2Timemm(jsonData.手术开始时间);
                        ssjssj.AsString = obj2Timemm(jsonData.手术结束时间);
                        cckssj.AsString = obj2Timemm(jsonData.穿刺开始时间);
                        cccgsj.AsString = obj2Timemm(jsonData.穿刺成功时间);
                        zykssj.AsString = obj2Timemm(jsonData.造影开始时间);
                        zyjssj.AsString = obj2Timemm(jsonData.造影结束时间);
                        scqnkzsj.AsString = obj2Timemm(jsonData.首次球囊扩张时间);
                        LeaveHospitalTime.AsString = IsEmpty(jsonData.LeaveHospitalTime) ? "" : (obj2Timemm(jsonData.LeaveHospitalTime));
                        Aspirin.AsString = IsEmpty(jsonData.Aspirin) ? "" : (jsonData.Aspirin + "mg");
                        Ticagrelor.AsString = IsEmpty(jsonData.Ticagrelor) ? "" : (jsonData.Ticagrelor + "mg");
                        Clopidogrel.AsString = IsEmpty(jsonData.Clopidogrel) ? "" : (jsonData.Clopidogrel + "mg");
                        Rosuvastatin.AsString = IsEmpty(jsonData.RosuvastatinYn) ? "" : (jsonData.Rosuvastatin + "mg");
                        Atorvastatin.AsString = IsEmpty(jsonData.AtorvastatinYn) ? "" : (jsonData.Atorvastatin + "mg");
                        RosuvastatinYn.AsString = IsEmpty(jsonData.RosuvastatinYn) ? "" : (jsonData.RosuvastatinYn + "mg");
                        AtorvastatinYn.AsString = IsEmpty(jsonData.AtorvastatinYn) ? "" : (jsonData.AtorvastatinYn + "mg");
                        Recordset.Post();
                        ReportViewer.Start();
                    }
                }
            });
        }
        function GetConsciousness(ids) {
            if (typeof (ids) == "undefined" || ids == null || ids.length <= 0) return "";
            var idArray = ids.split(',');
            var res = "";
            for (var i = 0; i < idArray.length; i++) {
                switch (parseInt(idArray[i])) {
                    case 0:
                        res += "清醒/";
                        break;
                    case 1:
                        res += "对语言有反应/";
                        break;
                    case 2:
                        res += "对刺痛有反应/";
                        break;
                    case 3:
                        res += "对任何刺激无反应/";
                        break;
                    default:
                        break;
                }
            }
            if (res.length > 0)
                res = res.substring(0, res.length - 1);
            return res;
        }
        function GetArriveClassName(id) {
            if (typeof (id) == "undefined" || id == null || id.length <= 0) return "";
            switch (parseInt(id)) {
                case 0:
                    return "未知";
                case 1:
                    return "120";
                case 2:
                    return "转院";
                case 3:
                    return "自行来院";
                case 4:
                    return "院内发病";
                default:
                    return "未知";
            }
        }
    </script>
</body>
</html>